import request from '@/utils/request'

const apiName = '/seckill'

// 秒杀商品列表
export function getPageList(page, limit) {
  return request({
    url: `${apiName}/getPageList/${page}/${limit}`,
    method: 'get'
  })
}
// 普通商品列表
export function getGoodsPage(page, limit) {
  return request({
    url: `/goods/getPageList/${page}/${limit}`,
    method: 'get'
  })
}

export function getById(id) {
  return request({
    url: `${apiName}/getById/${id}`,
    method: 'get'
  })
}

export function updateGoods(obj) {
  return request({
    url: `/goods/updateGoods`,
    method: 'post',
    data: obj
  })
}

export function getPath(goodsId) {
  return request({
    url: `${apiName}/getPath/${goodsId}`,
    method: 'get'
  })
}

export function goMiao(path, goodsId) {
  return request({
    url: `${apiName}/${path}/seckill`,
    method: 'post',
    params: { goodsId: goodsId }
  })
}

export function getResult(goodsId) {
  return request({
    url: `${apiName}/result`,
    method: 'get',
    params: { goodsId: goodsId }
  })
}

export function getOrderInfo(page, limit) {
  return request({
    url: `/order/detail/${page}/${limit}`,
    method: 'get',
    params: { }
  })
}

